﻿using Model.mongomodel;
using PayBLL.ERPHelper;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var sdate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00");
                var date = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59");
           
                Stopwatch sb = new Stopwatch();
                sb.Start();
                var OdbcDataReader = OdbcHelper.ExecuteDataTable("DSN=wuerp;uid=wuerp;pwd=wuerp", $"exec up_get_access 'alipay_mx','{sdate}','{date}','%','%','%','%','%'", null);
                sb.Stop();
                Console.WriteLine($"抓取时间：{sb.ElapsedMilliseconds.ToString()}");
                var list = DtToList<alipay>.ConvertToModel(OdbcDataReader);
                Console.WriteLine($"获取数据条数{list.Count()}");
                Console.ReadLine();
                //写入mongo
                

            }
            catch (Exception e)
            {
                Console.WriteLine($"ErpStart 更新异常{e.Message}");
            }
        }
    }
}
